package com.ruoyi.business.service.impl;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.HurtDoctorAdviceMapper;
import com.ruoyi.business.domain.HurtDoctorAdvice;
import com.ruoyi.business.service.IHurtDoctorAdviceService;

/**
 * 医师医嘱Service业务层处理
 *
 * @author ruoyi
 * @date 2024-04-24
 */
@Service
public class HurtDoctorAdviceServiceImpl implements IHurtDoctorAdviceService
{
    @Autowired
    private HurtDoctorAdviceMapper hurtDoctorAdviceMapper;

    /**
     * 查询医师医嘱
     *
     * @param id 医师医嘱主键
     * @return 医师医嘱
     */
    @Override
    public HurtDoctorAdvice selectHurtDoctorAdviceById(Long id)
    {
        return hurtDoctorAdviceMapper.selectHurtDoctorAdviceById(id);
    }

    /**
     * 查询医师医嘱列表
     *
     * @param hurtDoctorAdvice 医师医嘱
     * @return 医师医嘱
     */
    @Override
    public List<HurtDoctorAdvice> selectHurtDoctorAdviceList(HurtDoctorAdvice hurtDoctorAdvice)
    {
        return hurtDoctorAdviceMapper.selectHurtDoctorAdviceList(hurtDoctorAdvice);
    }

    /**
     * 新增医师医嘱
     *
     * @param hurtDoctorAdvice 医师医嘱
     * @return 结果
     */
    @Override
    public int insertHurtDoctorAdvice(HurtDoctorAdvice hurtDoctorAdvice)
    {
        hurtDoctorAdvice.setCreateTime(DateUtils.getNowDate());
        return hurtDoctorAdviceMapper.insertHurtDoctorAdvice(hurtDoctorAdvice);
    }

    /**
     * 修改医师医嘱
     *
     * @param hurtDoctorAdvice 医师医嘱
     * @return 结果
     */
    @Override
    public int updateHurtDoctorAdvice(HurtDoctorAdvice hurtDoctorAdvice)
    {
        return hurtDoctorAdviceMapper.updateHurtDoctorAdvice(hurtDoctorAdvice);
    }

    /**
     * 批量删除医师医嘱
     *
     * @param ids 需要删除的医师医嘱主键
     * @return 结果
     */
    @Override
    public int deleteHurtDoctorAdviceByIds(Long[] ids)
    {
        return hurtDoctorAdviceMapper.deleteHurtDoctorAdviceByIds(ids);
    }

    /**
     * 删除医师医嘱信息
     *
     * @param id 医师医嘱主键
     * @return 结果
     */
    @Override
    public int deleteHurtDoctorAdviceById(Long id)
    {
        return hurtDoctorAdviceMapper.deleteHurtDoctorAdviceById(id);
    }

    @Override
    public List<Map<String, Object>> getAdviceByPatient(Long doctorId, Long patientId) {
        return hurtDoctorAdviceMapper.getAdviceByPatient(doctorId,patientId);
    }

    @Override
    public List<Map<String, Object>> getAdviceListByPatient(Long patientId) {
        return hurtDoctorAdviceMapper.getAdviceListByPatient(patientId);
    }

    @Override
    public Map<String, Object> getAdviceDetailById(Long id) {
        return hurtDoctorAdviceMapper.getAdviceDetailById(id);
    }
}
